package com.ln.prac.base.m202206.d23.interpret;

/**
 * <pre>
 *  Test
 * </pre>
 *
 * @Author zhangj
 * @Date 2022/6/23 19:21
 */
public class Test {

    public static void main(String[] args) {
        // 定义变量
        Variable a = new Variable("a");
        Variable b = new Variable("b");
        Variable c = new Variable("c");

        // 赋值
        Context context = new Context();
        context.assign(a, 1);
        context.assign(b, 2);
        context.assign(c, 3);

        // 计算
        AbstraceExporess exporess = new Plus(a, new Plus(b, c));

        //打印计算过程与结果
        System.out.println(exporess);
        System.out.println(exporess.interpret(context));

    }

}
